<template>
	<view class="content">

		<image class="ui_bg" src="/static/img/bg_mine.png" mode=""></image>

		<view class="ui_info" :style="'margin-top:'+top+'rpx'">
			<image class="ui_info_head" src="/static/img/icon_default.png" mode=""></image>
			<view class="ui_info_name">卷尼尼尼</view>
			<view class="ui_info_dj">
				<view :class="'ui_info_dj_type ' + getClazz()">
					<image class="ui_info_dj_type_icon" src="/static/img/icon_zhuanshi.png" mode=""></image>
					<view class="ui_info_dj_type_text" v-if="type==0">城市运营商</view>
					<view class="ui_info_dj_type_text" v-else-if="type==1">店主</view>
					<view class="ui_info_dj_type_text" v-else-if="type==2">批发商</view>
				</view>

				<view class="ui_info_dj_text">推荐人：张舒然</view>
			</view>
		</view>

		<view class="ui_balance" v-if="type != 1">
			<view class="ui_balance_text">我的钱包（元）</view>
			<view class="ui_balance_money">1725.50</view>
			<view class="ui_balance_btn" @click="goTo('/pages/user/balance')">明细</view>
		</view>

		<view class="ui_invite" :style="'background-image: url('+url+'icon_mine_tg.png);'">

			<view class="ui_invite_time">
				距结束剩余
				<p>23</p>:
				<p>18</p>:
				<p>30</p>
			</view>
			<view class="ui_invite_more" @click="goTo('/pages/user/invite_list')">
				推荐列表
				<u-icon name="arrow-right" size="10" color="#ffffff"></u-icon>
			</view>

			<view class="ui_invite_info">
				<view class="ui_invite_info_item">
					<view class="ui_invite_info_item_num">27</view>
					<view class="ui_invite_info_item_text">邀约人数</view>
				</view>
				<view class="ui_invite_info_item">
					<view class="ui_invite_info_item_num">27</view>
					<view class="ui_invite_info_item_text">成功邀约</view>
				</view>
			</view>
		</view>

		<view class="ui_menu">
			<view class="ui_menu_lable">常用工具</view>
			<view class="ui_menu_list">
				<view class="ui_menu_list_item" v-for="(item,index) in menus" :key="index" @click="goTo(item.path)">
					<image class="ui_menu_list_item_icon" :src="item.icon" mode="heightFix"></image>
					<text class="ui_menu_list_item_text">{{item.name}}</text>
				</view>
			</view>
		</view>

		<view class="ui_menu2">
			<view class="ui_menu2_item" @click="goTo('/pages/user/setting')">
				<image class="ui_menu2_item_icon" src="/static/img/icon_mine_f_0.png" mode="heightFix"></image>
				<text class="ui_menu2_item_text">信息设置</text>
				<u-icon name="arrow-right" size="20" color="#B5B5B5"></u-icon>
			</view>
			<view class="ui_menu2_item">
				<image class="ui_menu2_item_icon" src="/static/img/icon_mine_f_1.png" mode="heightFix"></image>
				<text class="ui_menu2_item_text">联系客服</text>
				<u-icon name="arrow-right" size="20" color="#B5B5B5"></u-icon>
			</view>
			<view class="ui_menu2_item" @click="goTo('/pages/user/xiyi')">
				<image class="ui_menu2_item_icon" src="/static/img/icon_mine_f_2.png" mode="heightFix"></image>
				<text class="ui_menu2_item_text">用户隐私协议</text>
				<u-icon name="arrow-right" size="20" color="#B5B5B5"></u-icon>
			</view>
			<view class="ui_menu2_item">
				<image class="ui_menu2_item_icon" src="/static/img/icon_mine_f_3.png" mode="heightFix"></image>
				<text class="ui_menu2_item_text">用户注册协议</text>
				<u-icon name="arrow-right" size="20" color="#B5B5B5"></u-icon>
			</view>
		</view>

		<view style="height: 240rpx;"></view>
		<tabbar :current-page="4"></tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 0, //0城市运营  1店主  2批发商
				top: 0,
				url: '',
				menus: [],
				menus1: [{
						name: '我的橱窗',
						path: '',
						icon: '/static/img/icon_mine_m_0.png'
					},
					{
						name: '推广海报',
						path: '',
						icon: '/static/img/icon_mine_m_1.png'
					},
					{
						name: '批发商邀请码',
						path: '/pages/user/invite_pifa',
						icon: '/static/img/icon_mine_m_2.png'
					},
					{
						name: '城市运营商\n邀请码',
						path: '/pages/user/invite_city',
						icon: '/static/img/icon_mine_m_3.png'
					},
					{
						name: '旗下批发商',
						path: '/pages/user/pifa_list',
						icon: '/static/img/icon_mine_m_4.png'
					},
					{
						name: '推荐城市\n运营商',
						path: '/pages/user/city_list',
						icon: '/static/img/icon_mine_m_5.png'
					},
					{
						name: '云库存',
						path: '/pages/user/stock',
						icon: '/static/img/icon_mine_m_6.png'
					},
					{
						name: '我的结算',
						path: '/pages/user/settlement',
						icon: '/static/img/icon_mine_m_7.png'
					},
					{
						name: '订单审核',
						path: '/pages/user/order_check',
						icon: '/static/img/icon_mine_m_8.png'
					}
				],
				menus2: [{
						name: '我的橱窗',
						path: '',
						icon: '/static/img/icon_mine_m_0.png'
					},
					{
						name: '推广海报',
						path: '',
						icon: '/static/img/icon_mine_m_1.png'
					},
					{
						name: '申请批发商',
						path: '/pages/user/apply_pifa',
						icon: '/static/img/icon_mine_m_9.png'
					},
					{
						name: '申请运营商',
						path: '/pages/user/apply_city',
						icon: '/static/img/icon_mine_m_10.png'
					}
				],
				menus3: [{
						name: '我的橱窗',
						path: '',
						icon: '/static/img/icon_mine_m_0.png'
					},
					{
						name: '推广海报',
						path: '',
						icon: '/static/img/icon_mine_m_1.png'
					},
					{
						name: '批发商邀请码',
						path: '/pages/user/invite_pifa',
						icon: '/static/img/icon_mine_m_2.png'
					},
					{
						name: '推荐批发商',
						path: '',
						icon: '/static/img/icon_mine_m_11.png'
					},
					{
						name: '云库存',
						path: '/pages/user/stock',
						icon: '/static/img/icon_mine_m_6.png'
					},
					{
						name: '我的结算',
						path: '/pages/user/settlement',
						icon: '/static/img/icon_mine_m_7.png'
					}
				]
			}
		},
		onLoad() {
			let button = uni.getMenuButtonBoundingClientRect();
			console.log(button)
			this.top = (button.top + button.height) * 2
			this.url = this.$config.domain.app_ico
			if (this.type == 0) {
				this.menus = this.menus1
			} else if (this.type == 1) {
				this.menus = this.menus2
			} else if (this.type == 2) {
				this.menus = this.menus3
			}
		},
		methods: {
			getClazz() {
				let clazz = ''
				if (this.type == 0) {
					clazz = ''
				} else if (this.type == 1) {
					clazz = 'type1'
				} else if (this.type == 2) {
					clazz = 'type2'
				}
				return clazz
			},
			goTo(url) {
				console.log(url)
				this.$util.navTo(url)
			},
		}
	}
</script>

<style lang="less">
	.content {
		width: 750rpx;
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.ui_menu {
			margin-top: 20rpx;
			width: 714rpx;
			background: rgba(255, 255, 255, 0.99);
			border-radius: 10rpx;
			display: flex;
			flex-direction: column;

			&_lable {
				margin-top: 30rpx;
				margin-left: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
			}

			&_list {
				display: flex;
				flex-wrap: wrap;
				padding-bottom: 30rpx;

				&_item {
					width: 178rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #333333;

					&_icon {
						margin-top: 10rpx;
						margin-bottom: 5rpx;
						width: 80rpx;
						height: 80rpx;
					}

					&_text {
						text-align: center;
						height: 60rpx;
					}
				}
			}
		}

		.ui_menu2 {
			margin-top: 20rpx;
			display: flex;
			flex-direction: column;
			width: 714rpx;
			background: #FFFFFF;
			border-radius: 10rpx;
			padding: 20rpx 18rpx;

			&_item {
				width: 678rpx;
				height: 100rpx;
				display: flex;
				align-items: center;

				&_icon {
					width: 48rpx;
					height: 48rpx;
					margin-right: 15rpx;
				}

				&_text {
					flex: 1;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 30rpx;
					color: #363332;
				}
			}
		}

		.ui_bg {
			position: absolute;
			top: 0;
			left: 0;
			width: 750rpx;
			height: 480rpx;
			z-index: 88;
		}

		.ui_invite {
			margin-top: 20rpx;
			background-size: cover;
			width: 714rpx;
			height: 230rpx;
			z-index: 89;
			position: relative;

			&_time {
				position: absolute;
				top: 30rpx;
				left: 200rpx;
				display: flex;
				z-index: 889;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 20rpx;
				color: #333333;

				p {
					margin: 0 10rpx;
					width: 30rpx;
					line-height: 30rpx;
					height: 30rpx;
					text-align: center;
					background: #AC7F3B;
					border-radius: 10rpx;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 20rpx;
					color: #FFFFFF;
				}
			}

			&_more {
				position: absolute;
				top: 20rpx;
				right: 40rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFF8EC;
				display: flex;
				align-items: center;
				height: 40rpx;
			}

			&_info {
				width: 100%;
				margin-top: 80rpx;
				display: flex;

				&_item {
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;

					&_num {
						font-family: D-DIN Condensed;
						font-weight: bold;
						font-size: 48rpx;
						color: #333333;
						margin-top: 20rpx;
					}

					&_text {
						margin-top: 5rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #333333;
					}
				}
			}
		}

		.ui_balance {
			margin-top: 30rpx;
			background-image: url('/static/img/icon_mine_qb.png');
			background-size: cover;
			width: 714rpx;
			height: 180rpx;
			z-index: 89;
			position: relative;
			display: flex;
			flex-direction: column;

			&_text {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFE8C3;
				margin-top: 40rpx;
				margin-left: 47rpx;
			}

			&_money {
				margin-left: 47rpx;
				font-family: D-DIN Condensed;
				font-weight: bold;
				font-size: 64rpx;
				color: #F6DCB2;
				background: linear-gradient(0deg, #FFFAF2 0%, #FAE6C3 100%);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
			}

			&_btn {
				position: absolute;
				right: 50rpx;
				top: 30rpx;
				width: 120rpx;
				line-height: 50rpx;
				text-align: center;
				background: linear-gradient(0deg, #F7E2C2 0%, #FFFFFF 100%);
				border-radius: 25rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #2C220E;
			}
		}

		.ui_info {
			margin-top: 120rpx;
			width: 750rpx;
			display: flex;
			position: relative;
			z-index: 89;

			&_head {
				margin-left: 30rpx;
				width: 120rpx;
				height: 120rpx;
				border-radius: 60rpx;
			}

			&_name {
				position: absolute;
				left: 170rpx;
				top: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: #333333;
				line-height: 5rpx;
			}

			&_dj {
				position: absolute;
				left: 170rpx;
				top: 70rpx;
				display: flex;
				align-items: center;

				&_type {
					display: flex;
					align-items: center;
					height: 36rpx;
					background: linear-gradient(0deg, #2E240F, #0C0700);
					border-radius: 18rpx;
					color: #EAD5B2;

					&_icon {
						margin-left: 5rpx;
						margin-right: 5rpx;
						width: 36rpx;
						height: 36rpx;
					}

					&_text {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 22rpx;
						margin-right: 13rpx;
					}
				}

				.type1 {
					background: linear-gradient(0deg, #EDBE9D 0%, #D79261 100%);
					color: #ffffff;
				}

				.type2 {
					background: linear-gradient(0deg, #8097D1, #6B7AB3);
					color: #ffffff;
				}

				&_text {
					margin-left: 20rpx;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 22rpx;
					color: #9F6F26;
				}

			}
		}
	}
</style>